<!-- numbox -->
<template>
  <div class="mui-numbox" data-numbox-min="1" data-numbox-max="9">
    <button class="mui-btn mui-btn-numbox-minus" type="button">-</button>
    <input id="test" class="mui-input-numbox" type="number" ref="count" value="1" @change="countChanged"/>
    <button class="mui-btn mui-btn-numbox-plus" type="button">+</button>
  </div>
</template>

<script>
import mui from '../../../public/lib/mui/js/mui.js'
export default {
  data() {
    return {};
  },
  props: ['maxCount'],
  created() {},
  watch: {
    maxCount(newVal, oldVal) {
      mui(".mui-numbox").numbox().setOption('max', newVal);
    }
  },
  methods: {
    countChanged() {
      this.$emit('getCount', parseInt(this.$refs.count.value))
    }
  },

  components: {}
};
</script>

<style lang='scss' scoped>
</style>